package com.powerflasher.as3potrace.backend
{
   import com.powerflasher.as3potrace.geom.CubicCurve;
   import flash.display.GraphicsPath;
   import flash.display.IGraphicsData;
   import flash.geom.Point;
   
   public class GraphicsDataBackend implements IBackend
   {
       
      
      protected var gd:Vector.<IGraphicsData>;
      
      protected var gp:GraphicsPath;
      
      public function GraphicsDataBackend(param1:Vector.<IGraphicsData>)
      {
         super();
         this.gd = param1;
         this.gp = new GraphicsPath();
      }
      
      public function init(param1:int, param2:int) : void
      {
      }
      
      public function initShape() : void
      {
      }
      
      public function initSubShape(param1:Boolean) : void
      {
      }
      
      public function moveTo(param1:Point) : void
      {
         this.gp.moveTo(param1.x,param1.y);
      }
      
      public function addBezier(param1:Point, param2:Point, param3:Point, param4:Point) : void
      {
         var _loc7_:Vector.<Point> = null;
         var _loc5_:CubicCurve = new CubicCurve();
         _loc5_.drawBezierPts(param1,param2,param3,param4);
         var _loc6_:int = 0;
         while(_loc6_ < _loc5_.result.length)
         {
            _loc7_ = _loc5_.result[_loc6_];
            this.gp.curveTo(_loc7_[1].x,_loc7_[1].y,_loc7_[2].x,_loc7_[2].y);
            _loc6_++;
         }
      }
      
      public function addLine(param1:Point, param2:Point) : void
      {
         this.gp.lineTo(param2.x,param2.y);
      }
      
      public function exitSubShape() : void
      {
      }
      
      public function exitShape() : void
      {
      }
      
      public function exit() : void
      {
         this.gd.push(this.gp);
      }
   }
}
